package Core;

import javax.microedition.lcdui.Graphics;

/**
 * @author я
 */
public class TestControl extends Control
{
	public int bg = 0xffffff;

	public TestControl(String name, String caption, int w, int h)
	{
		super(name, caption, w, h);
	}

	public void draw(Graphics g, int x, int y)
	{
		if(state == Control.ACTIVE) bg = 0xffff00;
		if(state == Control.PRESSED) bg = 0x00ff00;
		if(state == Control.INACTIVE) bg = 0xff0000;

		g.setColor(bg);
		g.fillRect(x, y, getW()-1, getH()-1);
		
		g.setColor(0);
		g.drawRect(x, y, getW()-1, getH()-1);
		g.drawString(caption, x+(getW() - g.getFont().stringWidth(caption))/2, y + (getH() - g.getFont().getHeight())/2, Graphics.TOP | Graphics.LEFT);
	}
}
